package com.mapper;

import com.pojo.StudentS;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author 13565
 * @description 针对表【s_student】的数据库操作Mapper
 * @createDate 2024-11-19 14:49:56
 * @Entity com.pojo.StudentS
 */
public interface StudentSMapper {

    int deleteByPrimaryKey(Long id);

    int insert(StudentS record);

    int insertSelective(StudentS record);

    StudentS selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StudentS record);

    int updateByPrimaryKey(StudentS record);

    @Select("select * from s_student where id = #{id}")
    StudentS selectStudentsById (int id);

    @Update("update s_student set name = #{name},age = #{age},cid = #{cid}"+" where id = #{id}")
    int updateStudents(StudentS record);

    @Select("select * from s_student where cid = #{id}")
    @Results({
            @Result(id = true,column = "id",property = "id"),
            @Result(column = "name",property = "name"),
            @Result(column = "sge",property = "age"),
    })
    List<StudentS> selectStudentsByUserId(int id);
}